#include "MenuIdConvert.h"


#include "IdRootMenu.h"
#include "PipeConstDefine.h"
#include "mcore/tools/protactor/ProtactorConst.h"

namespace kepen {
namespace core {


uint  MenuIdConvert::GetIconTextByID(int id){


    uint ret = 0x0U;

    switch (id) {
    case DrawTool_MapPoint_2:
        ret = 0xe702U;
        break;
    case DrawTool_RectShape:
        ret = 0xe6e0U;
        break;
    case DrawTool_Circle:
        ret = 0xe814U;
        break;
    case IdentifyPick_ByCircle:
        ret = 0xe691U;
        break;
    case DrawTool_RectShape_2:
        ret = 0xe70bU;
        break;
    case DrawTool_Polygon_2:
        // 编辑图形
        ret = 0xe6a2U;
        break;
    case DrawTool_Polyline:

        ret = 0xe644U;
        break;
    case EditTool_Vector:
        ret = 0xe6d6U;
        break;
    case Option_EnSnapGraphic:
        ret = 0xe66bU;
        break;

    case FileSave_BtnId:
        ret = 0xe7d6U;
        break;
    case SaveClose_BtnId:
        ret = 0xe7e5U;
        break;
    case Goback_BarBtnId:
        ret = 0xe60fU;
        break;
    case Apply_Commit_BtnId:
        ret = 0xe7c7U;
        break;
    case Goback_WinBtnId:
        ret = 0xe634U;
        break;
    case ServiceGit_BtnId:
        ret = 0xe71eU;
        break;

    case LocationCombox:
        ret = 0xe7bfU;
        break;
    case LocationByRoad:
        ret = LocationByRoad_Code;
        break;
    case Gps_by_phone:
    case Gps_by_input:
        ret = Gps_by_input_Code;

        break;
    case LocationByFootmark:
        ret = LocationByFootmark_Code;
        break;
    case SetNULL_Geom:
        ret = 0xea15U;
        break;
    case Compass:
        ret = 0xe710U;
        break;
    case EnVisibleMapLayer:
        ret = 0xe669U;
        break;
    case UserInfo:
        ret = 0xe677U;
        break;
    case DataSynchro:
        ret = 0xe714U;
        break;
    case Setting:
        ret = 0xe7fdU;
        break;
    case Trail_footmark:
        ret = 0xe661U;
        break;
    case LayerIndex_BuildingLabel:
        ret = 0xe6bcU;
        break;
    case LayerIndex_PolygonSq:
        ret = 0xe69bU;
        break;
    case LayerIndex_PolygonSq2:
        ret = 0xe68fU;
        break;
    case LayerIndex_PolygonDistricts:
        ret = 0xe886U;
        break;
    case LayerIndex_Cadastre:
        ret = 0xe871U;
        break;
    case LayerIndex_Guideboard:
        ret = 0xe77bU;
        break;
    case LayerIndex_Footmark:
        ret = 0xe661U;
        break;
    case ID_corps:
        ret = 0xe728U;
        break;
    case DrawTool_MapPoint:
        ret = 0xe702U;
        break;

    case EditTool_Pan:
        ret = 0xe63aU;
        break;
    case EditTool_Zoom:
        ret = 0xe843U;
        break;

    case EditTool_Shear:
        ret = 0xe7dcU;
        break;
    case EditTool_Rotate:
        ret = 0xe64cU;
        break;


    case EditTool_RotateRect:
        ret = 0xe82aU;
        break;
    case MapTool_Protractor:
        ret = 0xe6e3U;
        break;
    case CleanTopLayer:
        ret = 0xe777U;
        break;
    case DrawTool_NewText:
        ret = 0xe6b5U;
        break;
    case DrawTool_NewLabel:
        ret = 0xe77bU;
        break;
    case EditTool_Normal:
        ret = 0xe660U;
        break;
    case ScrachTool_Normal:
        ret = 0xe7fbU;
        break;

    case OrderBy_BtnId:
        ret = 0xe7fcU;
        break;
    case Checkbox_ShiftAxis:
        ret = 0xe66cU;
        break;
    case Locaion_ByResident:
        ret = Locaion_ByResident_Code;
        break;
    case Data_ToVersionServ:
        ret = 0xe71eU;
        break;

    case EditTool_Attribute:
        ret = 0xe6f6U;
        break;
    case RestoreFromDelete:
        ret = 0xe7d8U;
        break;
    case AddPoint_BtnId:
        ret = 0xe66fU;
        break;
    case AddLine_BtnId:
        ret = 0xe675U;
        break;
    case AddPolygon_BtnId:
        ret = 0xe6e0U;
        break;
    case AddItemGrid_BtnId:
        ret = 0xe6ddU;
        break;
    case EditGeom_BtnId:
        ret = 0xe6a2U;
        break;
    case EditAttr_BtnId:
        ret = 0xe6f6U;
        break;
    case DeleteItem_BtnId:
        ret = 0xe776U;
        break;
    case CleanSelected_BtnId:
        ret = 0xe777U;
        break;
    case Filter_where_BtnId:
        ret = 0xe7d3U;
        break;
    case Identify_BtnId:
        ret = 0xe6c0U;
        break;
    case Roolback_Edited_BtnId:
        ret = 0xe758U;
        break;
    case savegrid2local_BtnId:
        ret = 0xe7d6U;
        break;
    case loadgridfromlocal_BtnId:
        ret = 0xe7d1U;
        break;
    case txbtn_deletetablelocal_BtnId:
        ret = 0xe7d8U;
        break;
    case EraseItem_BtnId:
        ret = 0xea15U;
        break;
    case Upload_BtnId:
        ret = 0xe73aU;
        break;
    case Download_BtnId:
        ret = 0xe73bU;
        break;
    case BootmRootStart:
        ret = 0xe7e7U;
        break;
    case CheckBox_CheckALL:
        ret = 0xe6f7U;
        break;
    case IdentifyPick_ByPoint:

        ret = 0xe74dU;
        break;
    case IdentifyPick_ByRect:

        ret = 0xe6c1U;
        break;
    case EditTool_LineSlide:
        ret = 0xe639U;
        break;
    // case IdentifyPick_ByPolygon:
    // case IdentifyPick_ByPolygon_Load:
    //     ret = 0xe617U;
    //     break;
    case EditLayerOther:
        ret = 0xe759U;
        break;
    case ClipGeometry:
        ret = 0xe7eeU;
        break;
    case ClipGeometry_Inter:
        ret = 0xe642U;
        break;
    case ClipGeometry_Remove:
        ret = 0xeddfU;
        break;
    case ID_Test:
        ret=0xe66dU;
        break;
    case Option_VisibleVertexIndex:
        ret=0xe62bU;
        break;
    case BarWinow_Close:
         ret=0xe634U;
        break;
    case BarWinow_Minimize:
        ret=0xe60aU;
        break;
    case Edit_AddVertexOnLine:
        ret=0xeddeU;
        break;
    case Edit_EraseVertex:
        ret=0xeddfU;
        break;
    case UpdateGPS_ByString:
        ret=0xe873U;
        break;
    case ArrayAddVertexByString:
        ret=0xe818U;
        break;
    case AngleMode_Hor:
        ret=0xe82aU;
        break;
    case AngleMode_Intersection:
        ret=0xe652U;
        break;

    default:
        ret = NoLaelFinded;
        break;
    }

    return ret;

}

QString MenuIdConvert::GetLabelByID(int id)
{
    if(Label_Add ==id)
        return QString("添加");
    else if(Label_Update ==id)
        return QString("修改");
    else if(Label_LoadGeometry ==id)
        return QString("载入画板");
    else if(Label_DrawTool ==id)
        return QString("绘制");
    else if(Label_ImportGpsVal ==id || ArrayAddVertexByString ==id)
        return QString("批量导入坐标");
    else if(UpdateGPS_ByString == id)
        return QString("GPS坐标");
    else if(Edit_AddVertexOnLine == id){
          return QString("添加顶点");
    }    else if(Edit_EraseVertex == id){
        return QString("移除顶点");
    }
    else if(EditLayerOther ==id)
    {
        return QString("图层");
    }else if(Label_PickVertexOrEged == id)
        return QString("拾取");
    else if(ClipGeometry_Inter == id)
    {
        return QString("保留框内");
    }
    else if(ClipGeometry_Remove == id)
    {
        return QString("擦除框内");
    }else if(ClipBrushType_Combox == id)
    {
         return QString("笔刷");
    }else if(AffineTool_Combox == id)
    {
        return QString("变换");
    }
    return QString("Undefine");
}

kepen::core::DrawTool::DrawType MenuIdConvert::GetDrawTypeByID(int id)
{
    kepen::core::DrawTool::DrawType d = kepen::core::DrawTool::DrawType::MapPoint;
    if(id>DrawTool_TypeNone && id<=DrawTool_LineSegment){
        int t =   id - DrawTool_TypeNone;
        d =  kepen::core::DrawTool::DrawType(t);
    }else if(id>IdentifyPick_ComboBox && id <= 280){
        int t =   id - IdentifyPick_ComboBox;
        d =  kepen::core::DrawTool::DrawType(t);
    }else if( id >= 0 && id <=  kepen::core::DrawTool::DrawType::LineSegment )
    {
       d =  kepen::core::DrawTool::DrawType(id);
    }

    return d;
}

}
}
